package main

import (
	"github.com/asim/go-micro/v3"
	"github.com/go-micro/plugins/v3/registry/consul"
	"github.com/asim/go-micro/v3/registry"
	"context"
	pb "emicro_test/emicro_5/grpc_server/user_client/pbfile"
	"fmt"
)

func main(){
	consulRegis := consul.NewRegistry(func(options *registry.Options) {
		options.Addrs = []string{
			"127.0.0.1:8500",
		}
	})

	service := micro.NewService(
		micro.Name("emicro.user.client"),
		micro.Registry(consulRegis),
	)
	userService := pb.NewUserService("emicro.user", service.Client())
	res, err := userService.TestUser(context.TODO(), &pb.TestReq{Id:1150})
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(res)
}
